home *** CD-ROM | disk | FTP | other *** search
- Path: news.cyberport.com!usenet
- From: tangent@cyberport.com (Warren Young)
- Newsgroups: comp.lang.c++
- Subject: Re: The STL and nested structures
- Date: Sun, 14 Apr 1996 09:02:59 GMT
- Organization: none
- Message-ID: <3170bdd7.308224233@news.cyberport.com>
- References: <4ju9q7$fa1$1@mhadg.production.compuserve.com> <316a26d7.2989288@news.cyberport.com> <marnoldDpn0HH.3z2@netcom.com>
- NNTP-Posting-Host: ppp4.cyberport.com
- X-Newsreader: Forte Agent .99d/32.182
-
- marnold@netcom.com (Matt Arnold) wrote:
-
- >>>I am having a problem using the STL with structures defined within
- >>>a class definition. Consider the following code fragment.
- >>>...
- >>>The compiler I am using (VC 4.1) refuses to compile. An error is
- >>>generated the says "'Foo' : undeclared identifier" at line 75 in
- >>>vector.h.
- >
- >>It _is_ undeclared, just as a variable local to a function foo() is
- >>undeclared in a function bar(). What you want to say is:
- >
- >This should not be necessary. Nested class Foo should be visible for
- >use in template member Bar::fooContainer. fooContainer is in Bar's
- >scope. There should be no problem referring to it within Bar.
-
- Yep, you're right. I didn't look at the code carefully enough.
-
- >I think Visual C++ is broken on the above code. It compiles fine in
- >Borland C++.
-
- Once again, I'm pulled back from the MS abyss...
-
- >>Even this won't work until Foo is placed in the public section of the
- >>class (as shown above, it's in the private (default) section).
- >
- >That requirement would make private nested implementation class'
- >impossible, wouldn't it?
-
- Assuming he was declaring the vector outside the class's scope, I was
- right. Once you get the straight dope on that, and the rest of the
- post is rubbish. It all depended on that one premise.
-
- >Is it true that STL is currently incorrectly implemented?
-
- By who, and in what regard? I hadn't heard anything of this. Unless
- of course you count the hacks necessary to get STL to compile on the
- current state of the art compilers. For example, I don't know of any
- "popular" C++ compilers that support default template parameters
- (maybe BC++ 5.0 does now...). Many things in STL require this (map
- for instance) but they're being faked with some preprocessor trickery.
-
-
- I haven't actually vgrepped the code for this sort of thing, though,
- so I'm not sure of the details.
-
- = Warren --
-